<template>
  <div class="settings-view">
    <h1>系统设置</h1>

    <div class="settings-form">
      <div class="form-group">
        <label>服务器IP地址</label>
        <input
            type="text"
            v-model="serverIp"
            placeholder="例如：192.168.103.27"
        >
      </div>

      <div class="form-group">
        <label>服务器端口</label>
        <input
            type="number"
            v-model="serverPort"
            placeholder="例如：8098"
        >
      </div>

      <button class="save-btn" @click="saveSettings">
        保存设置
      </button>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import { useExamStore } from '@/stores/examStore'

const examStore = useExamStore()
const serverIp = ref('192.168.103.27')
const serverPort = ref(8098)

const saveSettings = () => {
  // 这里可以添加保存设置到store或后端的逻辑
  alert(`设置已保存: IP ${serverIp.value}, 端口 ${serverPort.value}`)
}
</script>

<style scoped>
.settings-view {
  padding: 20px;
  max-width: 600px;
  margin: 0 auto;
}

h1 {
  color: #2c3e50;
  margin-bottom: 30px;
}

.settings-form {
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #555;
}

input {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 16px;
}

.save-btn {
  background-color: #4285f4;
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.3s;
}

.save-btn:hover {
  background-color: #3367d6;
}
</style>